//数组
int[] arr = [1, 2, 3, 4, 5]
println arr 
println "class is " + arr.class.name

arr.each {  e->
	print e
}
println()

// 集合
def col = ["123","haha",456];
col.add(444)
col.add 333
col += 555
col<<"wawa"
assert col instanceof Collection
assert col instanceof ArrayList
println col

//集合的操作
col -= 333
println col
def res = col.join('.')
println res
println col.size

ss = ['haha','wawa'];
ss=ss*.toUpperCase();
println ss

// Map
def map=[name:'andy','age':15]; //定义时key不能使用变量,使用变量要加()

println map.getClass()
//1.通过索引方式访问
assert map['name'] == 'andy'
assert map['num'] == null
map.num = 2 //没有这个key 则添加它,这个num代表一个字符串的'num'
assert map.'num' == 2
map += ['weight':120] //增加一个键值对
map[3] = 'who' // 数字不能通过 . 引用，只能用[]
def x = 'name'
map['x'] = 'xxxx'
map[x] = 'say'  //这两句的key是不一样的
assert map['name'] == 'say'
println map

def mm = [haha:'asd']
println mm

